<div class="wrapper">
    <hr>
    <table>
    <tr>
        <td align="left">
            <h2 class="ml"><span>{{ domain.getName() }}</span></h2>
        </td>
        <td align="right">
            <a href="" id="synch_dns" class="action" order="{{ order_name }}" domain="{{ domain.getName() }}">Синхронизировать DNS записи</a>
            <div id="load_icon_synch_dns" order="{{ order_name }}" style="display:none">
                Синхронизация DNS записей <img alt="загрузка" src="{{ asset('bundles/billing/i/load.gif') }}">
            </div>
            <div id="load_icon_synch_error" order="{{ order_name }}">
            </div>
        </td>
    </tr>
    </table>
    <table id="dns_list" order="{{ order_name }}">
    <tr>
        <td>
            <b>Имя</b>
        </td>
        <td>
            <b>Тип</b>
        </td>
        <td>
            <b>Значение</b>
        </td>
        <td>
            <b>Изменить</b>
        </td>
        <td width="10%"></td>
    </tr>
    {% for domainDns in domainsDns %}
        {% if domainDns.getIsActive %}
            {% include "BillingBundle:Orders_shared:user_index_active_dns_template.html.twig" %}
        {% else %}
            {% include "BillingBundle:Orders_shared:user_index_not_active_dns_template.html.twig" %}
        {% endif %}
    {% endfor %}
    </table>
    <br>
    Добавить запись:
    <form id="dns_add_form" order="{{ order_name }}">
    <table>
        <tr>
            <td aligh="right">
                тип: <select name="dns_type" order="{{ order_name }}" domain="{{ domain.getName() }}">
                    <option value="1">A</option>
                    <option value="2">NS</option>
                    <option value="3">MX</option>
                    <option value="4">CNAME</option>
                    <option value="5">PTR</option>
                    <option value="6">TXT</option>
                    <option value="7">AAAA</option>
                    <option value="8">SRV</option>
                    </select>
            </td>
            <td class="status"></td>
            <td>имя: <input type="text" name="dns_name" order="{{ order_name }}" domain="{{ domain.getName() }}"/></td>
            <td class="status"></td>
            <td>значение: <input type="text" name="dns_value" order="{{ order_name }}" domain="{{ domain.getName() }}"/></td>
            <td class="status"></td>
        </tr>
    </table>
    </form>
    <a href="" id="add_dns" order="{{ order_name }}" domain="{{ domain.getName() }}">Добавить</a>
    <div id="load_icon_create_dns" order="{{ order_name }}" domain="{{ domain.getName() }}" style="display:none">
        Отправление запроса <img alt="загрузка" src="{{ asset('bundles/billing/i/load.gif') }}">
    </div>
    <script type="text/javascript">
    var validator = $('#dns_add_form[order="{{ order_name }}"]').validate({
            rules: {
                    dns_name: {
                            required: true,
                            maxlength: 64,
                            check_dns: true
                    },
                    dns_value: {
                            required: true,
                            maxlength: 64,
                            check_dns: true
                    }
            },
            messages: {
                    dns_name: {
                            required: "Введите имя",
                            maxlength: jQuery.format("Не более {0} символов")
                    },
                    dns_value: {
                            required: "Введите значение",
                            maxlength: jQuery.format("Не более {0} символов")
                    }
            },

            errorPlacement: function(error, element) {
                    error.appendTo( element.parent().next() );
            },
            success: function(label) {
                    // set &nbsp; as text for IE
                    label.html("&nbsp;").addClass("checked");
            }
    });
    </script>
</div>
